-
Notifications
You must be signed in to change notification settings - Fork 102
feat(schema_cache): column
type + query
#163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(schema_cache): column
type + query
#163
Conversation
column
type + query
unnest (ix.indkey) as attnum, | ||
ix.indisprimary as is_primary, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if we're using compound indexes, e.g. (user_id, tax_number)
, we'd have is_primary == true
for tax_number
.
This might be problematic for index suggestions etc. – wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the effort to write a custom query, but what didn't you like from this one? :D
https://github.com/supabase/postgres-meta/blob/master/src/lib/sql/columns.sql
@psteinroe Ah, I wasn't aware of the We can use the But it does lack some info that seemed to me like we might need it in the future:
Of course I'm not sure whether we'll need that data and whether the query fetches it 100% correctly. :) Would you like me to use my query, the untouched |
let's use yours and we keep it in mind when issues come up that it might be worth to go to postgrest-meta for it |
Introduces an all-new, immediately-usable, delivered-straight-to-your-door data type in the
SchemaCache
: theColumn
.The next step is to use that data type in the
pg_completions
crate – so we can suggest columns in a select clause, based on the queried table.I wrote the query myself, with a little bit of help from ChatGPT and the postgres docs, so please make sure it follows best practices. 🙌🏻
Also wrote and renamed a test, and added full features for tokio on workspace level.